package com.example.wangfanwangluo.wangfanboss;

import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class forget extends AppCompatActivity {
    private Typeface iconfont;
    private TextView backtv;
    private EditText yanzhengmaet;
    private Button nextbtn;
    private Button againbtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forget);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        ActionBar actionbar = getSupportActionBar();
        if (actionbar != null){
            actionbar.hide();
        }
        initviews();

    }
    //初始化ui
    public void initviews(){
        iconfont = Typeface.createFromAsset(getAssets(), "iconfont/iconfont.ttf");
        backtv = (TextView)findViewById(R.id.backbtn);
        backtv.setTypeface(iconfont);
        yanzhengmaet = (EditText)findViewById(R.id.yanzhengma);
        nextbtn = (Button)findViewById(R.id.nextbtn);
        againbtn = (Button)findViewById(R.id.aginbtn);

        //添加监听事件
        backtv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //回到登录页面
               finish();
            }
        });

        nextbtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String yanstr = yanzhengmaet.getText().toString();
                if (yanstr.length() != 6){
                    Toast.makeText(forget.this,"验证码位数有误",Toast.LENGTH_SHORT).show();
                    return;
                }
                //验证码进行校验,网络请求
                //进入下一页
                Intent intent = new Intent(forget.this,Forget3.class);
                startActivity(intent);


            }
        });

        againbtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //重新发送验证码请求

            }
        });


    }





}
